package com.xuecheng.aicodenew.ai;

import com.xuecheng.aicodenew.ai.guardrail.SafeInputGuardrail;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.Result;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.guardrail.InputGuardrails;
import dev.langchain4j.service.spring.AiService;
import reactor.core.publisher.Flux;

import java.util.List;

//@AiService--直接使用不需要手写实现类，但是配置麻烦
@InputGuardrails(SafeInputGuardrail.class)//使用我们自定义的拦截器--护轨
public interface AiCodeHelperService {

    @SystemMessage(fromResource = "system-prompt.txt")
    String chat(String userMessage);


    @SystemMessage(fromResource = "system-prompt.txt")
    String chatForReport(String userMessage);


    //使用record定义一个数据类--学习报告
    record Report(String name, List<String> suggestionList){}



    //返回rag封装过的结果
    @SystemMessage(fromResource = "system-prompt.txt")
    Result<String> chatWithRag(String userMessage);


    //流式对话
    @SystemMessage(fromResource = "system-prompt.txt")
    Flux<String> chatSteam(@MemoryId int menoryId, @UserMessage String userMessage);
}
